package com.woniuxy.demo.epai.controller;


import com.woniuxy.demo.epai.common.Result;
import com.woniuxy.demo.epai.controller.form.IdCardForm;
import com.woniuxy.demo.epai.model.Members;
import com.woniuxy.demo.epai.service.impl.TestIdcardServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 身份信息表 前端控制器
 * </p>
 *
 * @author epai
 * @since 2021-04-15
 */
@RestController
@RequestMapping("/epai/test-idcard")
@Slf4j
public class TestIdcardController {
    @Autowired
    private TestIdcardServiceImpl testIdcardService;
    /**
     * 验证是否实名
     * @param user
     * @return
     */
    @PutMapping("/authenticationVip")
    public Result authenticationVip(@RequestBody IdCardForm idCardForm){
        log.info("传入的id为={}传入的姓名为={}",idCardForm.getName(),idCardForm.getIdcard());
        Integer id = testIdcardService.authenticationVip(idCardForm.getName(), idCardForm.getIdcard());
        //判断返回的数据是否为空，如果不为空则实名认证成功
        if(id!=null){
            return Result.success();
        }
        return Result.fail("实名失败,姓名或者身份证号错误");
    }
}

